import cv2
import numpy as np
from matplotlib import pyplot as plt

img = cv2.imread('../images/lenaNoise.png')
# 均值滤波
dst = cv2.blur(img, (5, 5))
# 方框滤波
box = cv2.boxFilter(img, -1, (5, 5), normalize=True)
# 中值滤波
median = cv2.medianBlur(img, 5)
# 高斯滤波
gauss = cv2.GaussianBlur(img, (5, 5), 1)

res = np.hstack((img, dst))
res1 = np.hstack((box, median))
res2 = np.vstack((res, res1))
cv2.imshow('res', res2)
cv2.imshow("gauss", gauss)
cv2.waitKey(0)
cv2.destroyAllWindows()